<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html>
	<head>
  		<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
	    <title>Bliss | <%= @title %></title>
	    <link rel="shortcut icon" type="image/x-icon" href="/bliss.ico"/>
		<%= stylesheet_link_tag 'scaffold', 'style', 'menu', 'jquery-ui-1.8.17.custom.css' %>
		<%= javascript_include_tag :defaults,'jquery-1.7.1.min.js', 'jquery-ui-1.8.17.custom.min.js','adapters/prototype-adapter.js','highcharts.js','modules/exporting.js','themes/grid'%>
		<script type="text/javascript">
			if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i))){
				var question = confirm("Do you wish to be redirected to the mobile portal ?")
				if (question){
					window.location = "<%= mobiles_path %>";
				}
			}
		</script>
		<script type="text/javascript">	
			$.noConflict();
			jQuery.noConflict();
			
			(function($){
				$.fn.writeError = function(message){return this.each(function(){
				var $this = $(this);
				var errorHtml = "<div class=\"ui-widget\"><div class=\"ui-state-error ui-corner-all\" style=\"padding: 0 .7em;\"><p><span class=\"ui-icon ui-icon-alert\" style=\"float:left; margin-right: .3em;\"></span>"+message+"</p></div></div>";
				$this.html(errorHtml);
			});}})(jQuery);	
			(function($){
			     $.fn.writeAlert = function(message){return this.each(function(){
			           var $this = $(this);
			           var alertHtml = "<div class=\"ui-widget\"><div class=\"ui-state-highlight ui-corner-all\" style=\"padding: 0 .7em;\"><p><span class=\"ui-icon ui-icon-info\" style=\"float:left; margin-right: .3em;\"></span>"+message+"</p></div></div>";
			           $this.html(alertHtml); 
			});}})(jQuery);
			
			jQuery(document).ready(function($) {
				var flash_notice = "<%= flash[:notice] %>";
				var flash_alert = "<%= flash[:alert] %>";
				var flash_error = "<%= flash[:error] %>";
				
				if (flash_notice != "") {
					$('#flash_notice').writeAlert('<b>Notice : </b>'+flash_notice).delay(3000).slideToggle('slow');
				}
				if (flash_alert != "") {
					$('#flash_alert').writeAlert('<b>Alert : </b>'+flash_alert).delay(3000).slideToggle('slow');
				}
				if (flash_error != "") {
					$('#flash_error').writeError('<b>Error : </b>'+flash_error).delay(3000).slideToggle('slow');
				}
				// Accordion
				$("#accordion").accordion({ disabled: true, active: 2, header: "h3" });
				$("#buttonLink").click(function (){
						$("#buttonMenu").slideToggle();
				});
				// Tabs
				$('#tabs').tabs();
				
				// Dialog
				$('#overview_panel').dialog({
					resizable: false,
					height: 125,
					width: 50,
					position: ['right', 'top'],
					title: "Overview"
				});
				// Dialog Fastform
				$('#fastform_dialog').dialog({
					autoOpen: false,
					autoHeight: true,
					width: 500,
					title: "Marde",
					modal: true,
					title: "Fast form"
				})
				
				// Button Fastform
				$('.fastForm_link').live('click', function () {
					$('#fastform_dialog').dialog('open');
				});
				// Button déclencheur
				$('#overview_link').click(function() {
					if ($('#overview_panel').dialog("isOpen")){
						$('#overview_panel').dialog( "close" );
					}
					else $('#overview_panel').dialog( "open" );
					return false;
				});
			});
		</script>
	</head>
	<body>
		<div class="messages" id="div_messages">
			<div id="flash_notice" class="cssDivResultat"><%= flash[:notice] %></div>
			<div id="flash_alert" class="cssDivResultat"><%= flash[:alert] %></div>
			<div id="flash_error" class="cssDivResultat"><%= flash[:error] %></div>
		</div>
		<div id="overview_panel" class="lateral_panel ui-corner ui-corner-all">
			<%= render :partial => 'layouts/lateral_panel'%>
		</div>
		<div class="site">
			<div class="header">
				<center><h1 id="jqm-logo"><span style="color: #cc0000;">Bliss</span> Project</h1></center>
				<div class="header_login">
					<% if logged_in? %>						
						<% link_to logout_path, :class => 'ui-state-default ui-corner-all dialog_link' do %>
							<span class="ui-icon ui-icon-key"></span>Logout <%=h current_user.login %>
						<% end %>
						<a id="overview_link" class="ui-state-default ui-corner-all dialog_link">
							<span class="ui-icon ui-icon-clipboard"></span>Overview
						</a>
					<% else %>
						<!-- Login button -->
						<% link_to login_path, :class => 'ui-state-default ui-corner-all dialog_link' do %>
							<span class="ui-icon ui-icon-key"></span>Login
						<% end %>
						<!-- Sign Up button -->
						<% link_to new_user_path, :class => 'ui-state-default ui-corner-all dialog_link' do %>
							<span class="ui-icon ui-icon-plus"></span>Sign up
						<% end %>
					<% end %>
				</div>
			</div>
				<div>
					<ul class="menu red">
					  <li><%= link_to 'Home', :controller => :home, :method => :index %></li>
					  <% if logged_in? %>
						  <li><%= link_to 'Companies', :controller => :companies, :method => :index %></li>
						  <li><%= link_to 'Rooms', :controller => :rooms, :method => :index %></li>
						  <li><%= link_to 'Computers', :controller => :computers, :method => :index %></li>
						  <li><%= link_to 'Networks', :controller => :networks, :method => :index %></li>
						  <li><%= link_to 'Operations', :controller => :operations, :method => :index %></li>
						  <li><%= link_to 'Contacts', :controller => :contacts, :method => :index %></li>
					  <%end%>
					  <li><%= link_to 'Users', :controller => :users, :method => :index %></li>
					</ul>	
				</div>
				<div class="container">
					<%= yield %>
				</div>
				<div class="footer">
					Propulsed BY : JACCK
					<br/><a href="http://code.google.com/p/bliss-project/" target=_blank>Google Doc BLISS PROJECT</a>
				</div>
			</div>
		</div>
	</body>
</html>